<?php if (!defined('THINK_PATH')) exit();?><!doctype html>
<html>
<head>
	<meta charset="UTF-8">
	
		<title><?php echo C('WEB_TITLE');?></title>
	
	<link rel="stylesheet" type="text/css" href="../Public/css/base.css" media="all">
	<link rel="stylesheet" type="text/css" href="../Public/css/module.css">
	<link rel="stylesheet" type="text/css" href="../Public/css/style.css" media="all">
	<link rel="stylesheet" type="text/css" href="__PUBLIC__/Js/artDialog/skins/default.css">
	<script type="text/javascript" src="__PUBLIC__/Js/jquery.js"></script>
	<script type="text/javascript" src="__PUBLIC__/Js/artDialog/jquery.artDialog.min.js"></script>
	<script type="text/javascript" src="__PUBLIC__/Js/artDialog/artDialog.plugins.min.js"></script>
	<script type="text/javascript" src="../Public/js/common.js"></script>
	<?php if(in_array((ACTION_NAME), explode(',',"add,edit"))): ?><script type="text/javascript" src="__PUBLIC__/Js/ValidForm.js"></script><?php endif; ?>
	
	<script type="text/javascript">
        var URL	   ='__URL__';
        var PUBLIC = "../Public/";
    </script>
</head>
<body style="padding:0;">
	
	<div id="main-content">
		<div id="top-alert" class="fixed alert alert-error" style="display: none;">
			<button class="close fixed" style="margin-top: 4px;">&times;</button>
			<div class="alert-content">这是内容</div>
		</div>
		<div id="main" class="main">
			
	<style type="text/css">
	.list{margin-top: 5px;}
	.list li {list-style: none;display: inline-block;margin-left: 10px;width: 200px;}
	label{cursor: pointer;}
	.form{
		border-top:1px solid #CCCCCC;
		padding-top: 10px;
	}
	</style>
	<div class="main-title">
		<h2>备份还原</h2>
	</div>
	<div class="tab-wrap">
		<ul class="tab-nav nav">
			<li class="current"><a href="#">备份</a></li>
			<li><a href="#">还原</a></li>
		</ul>
		<div class="tab-content" id="beifen">
			<form method="post" class="form-horizontal" name="ReservedForm1" action="__url__/reserved">
				<div class="form-item">
					<label class="item-label"></label>
					<div class="controls">
						<label><input type="checkbox" value="send" name="is_email" />备份完成后发送到邮箱</label>
						<input type="text" name="email" class="text input-large" value="<?php echo c('web_mail');?>" />
					</div>
				</div>
				<div class="form-item">
					<label class="item-label"></label>
					<div class="controls">
					<label><input type="checkbox" value="download" name="is_download" />备份完成后立刻下载到本地</label>
					</div>
				</div>
				<div class="form-item">
					<label class="item-label"></label>
					<div class="controls">
						<ul class="list">
							<?php if(is_array($dblist)): $i = 0; $__LIST__ = $dblist;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><li>
								<input type="checkbox" value="<?php echo ($vo); ?>" name="tobackup[]" id="tobackup<?php echo ($i); ?>" checked />
								<label for="tobackup<?php echo ($i); ?>"><?php echo ($vo); ?></label>
							</li><?php endforeach; endif; else: echo "" ;endif; ?>
						</ul>
					</div>
				</div>
				<div class="form-item">
					<label class="item-label"></label>
					<div class="controls">
						<button type="submit" class="btn submit-btn ajax-post" target-form="form-horizontal">开始备份</button>
					</div>
				</div>
			</form>
		</div>
		<div class="tab-content" id="huanyuan">
			<form method="post" class="form-horizontal" name="RestoreForm1" action="__url__/restore">
				<?php
 foreach(glob('./BACKUP/*') as $v){ if(is_dir($v)){ $backlist[]= $v; } } ?>
				<?php if(is_array($backlist)): $i = 0; $__LIST__ = $backlist;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$bvo): $mod = ($i % 2 );++$i;?><div class="form-item">
						<label class="item-label"></label>
						<div class="controls">
							<label>
								<input type="radio" value="<?php echo ($bvo); ?>" name="torestore" id="torestore<?php echo ($i); ?>"/>
								<label for="torestore<?php echo ($i); ?>"><?php echo (str_replace('_',':',str_replace('./BACKUP/', '',$bvo))); ?>
							</label>
						</div>
					</div><?php endforeach; endif; else: echo "" ;endif; ?>
				<div class="form-item">
					<label class="item-label"></label>
					<div class="controls">
						<button type="submit" class="btn submit-btn ajax-post">开始还原</button>
					</div>
				</div>
			</form>
		</div>
	</div>
	<div class="page"><div><?php echo ($page); ?></div></div>

		</div>
		<!-- <div class="cont-ft">
			<div class="copyright">
				<div class="fl">感谢使用<a href="http://www.onethink.cn" target="_blank">OneThink</a>管理平台</div>
				<div class="fr">V1.0.131129</div>
			</div>
		</div> -->
	</div>
	<script type="text/javascript">
        +function(){
            var $window = $(window), $subnav = $("#subnav"), url;
            $window.resize(function(){
                $("#main").css("min-height", $window.height() - 130);
            }).resize();
            $("#subnav h3 a").click(function(e){e.stopPropagation()});
	        /* 表单获取焦点变色 */
	        $("form").on("focus", "input", function(){
		        $(this).addClass('focus');
	        }).on("blur","input",function(){
				        $(this).removeClass('focus');
			        });
		    $("form").on("focus", "textarea", function(){
			    $(this).closest('label').addClass('focus');
		    }).on("blur","textarea",function(){
			    $(this).closest('label').removeClass('focus');
		    });
            // 导航栏超出窗口高度后的模拟滚动条
            var sHeight = $(".sidebar").height();
            var subHeight  = $(".subnav").height();
            var diff = subHeight - sHeight; //250
            var sub = $(".subnav");
            if(diff > 0){
                $(window).mousewheel(function(event, delta){
                    if(delta>0){
                        if(parseInt(sub.css('marginTop'))>-10){
                            sub.css('marginTop','0px');
                        }else{
                            sub.css('marginTop','+='+10);
                        }
                    }else{
                        if(parseInt(sub.css('marginTop'))<'-'+(diff-10)){
                            sub.css('marginTop','-'+(diff-10));
                        }else{
                            sub.css('marginTop','-='+10);
                        }
                    }
                });
            }
        }();
		//搜索功能
		$("#search").click(function(){
			var url = $(this).attr('url');
	        var query  = $('.search-form').find('input').serialize();
	        query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
	        query = query.replace(/^&/g,'');
	        if( url.indexOf('?')>0 ){
	            url += '&' + query;
	        }else{
	            url += '?' + query;
	        }
			window.location.href = url;
		});
		//回车搜索
		$(".search-input").keyup(function(e){
			if(e.keyCode === 13){
				$("#search").click();
				return false;
			}
		});
		$(function(){
			$('.row td:gt(0)').attr('nowrap','');
			$('.row th:gt(0)').attr('nowrap','');
			$('.row:gt(0)').click(function(e){
				if(e.target.name!='key'){
					// && !e.target.href
					var xx=$(this).find(':checkbox');
					xx.attr('checked',!xx.attr('checked'));
				}
			});
			$('.Abstruct').each(function(){
				if ($(this).attr('type')=='img'){
					var src=$(this).html();
					$(this).click(function(){
						$.dialog({ 
							title:'查看图片',
							content: src+'<br><img src="'+src+'" />'
						}); 
					});
				}else{
					var src=$(this).html();
					$(this).click(function(){
						$.dialog({ 
							title:'查看详细',
							content: eval(src)
						}); 
					});
				}
				$(this).attr('title',$(this).html());
			});

		})
	</script>
	
	<script type="text/javascript">
	$('.nav li').click(function(){
		var i=$('.nav li').index($(this));
		$('.nav li').removeClass('current');
		$(this).addClass('current');
		$('.tab-content').hide();
		$('.tab-content:eq('+i+')').show();
	});
	</script>

</body>
</html>